Page({
  data: {
    id: '',
    point: '',
    building: '',
    room: '',
    name: '',
    gender: Number,
    mobile: '',
    idcardBackUrl: '',
    idcardFrontUrl: '',
    status: '',
    statusList: ['正在审核', '审核通过', '审核失败'],
    statuslist: ['info', 'success', 'fail'],
    state: 'modify',
  },
  async onLoad(params) {
    console.log(params)
    const { data } = await wx.http.get(`/room/${params.id}`)
    console.log(data)
    this.setData({
      id: params.id,
      point: data.point,
      building: data.building,
      room: data.room,
      gender: data.gender,
      idcardBackUrl: data.idcardBackUrl,
      idcardFrontUrl: data.idcardFrontUrl,
      status: data.status,
      mobile: data.mobile,
      name: data.name,
    })
  },
  editHouse() {
    wx.navigateTo({
      url: `/house_pkg/pages/form/index?type=${this.data.state}&id=${this.data.id}&point=${this.data.point}&building=${this.data.building}&room=${this.data.room}&name=${this.data.name}&gender=${this.data.gender}&mobile=${this.data.mobile}&idcardFrontUrl=${this.data.idcardFrontUrl}&idcardBackUrl=${this.data.idcardBackUrl}`,
    })
  },
})
